import java.util.*;
public class MySort {
    public static void main(String [] args) {
        String [] toSort = {"aaa:10:1:1",
                "ccc:30:3:4",
                                           "bbb:50:4:5",
                                        "ddd:20:5:3",
                                          "eee:40:2:20"};
            System.out.println("Before sort:");
            for (String str: toSort)
                               System.out.println(str);

             Integer [] tmp = new Integer [toSort.length];
              for(int i=0; i<tmp.length; i++)
                        tmp[i] = new Integer(Integer.parseInt(toSort[i].split(":")[1]));

               Arrays.sort(tmp);

                System.out.println("After sort:");

             for(int i=0; i<tmp.length; i++)
                      for(int j=0; j<toSort.length; j++)
                            if(Integer.parseInt(toSort[j].split(":")[1]) == tmp[i].intValue())
                                System.out.println(toSort[j]);
         }
 }
